<?php


class Simpleshop_Model_DbTable_Basket_Rowset extends WSB_Db_Rowset
{

	/**
	 * @param float $shippingAndHandlingCosts
	 * @return float
	 */
	public function getTotalPrice($shippingAndHandlingCosts = 0)
	{
		$total = 0;
		foreach($this AS $row) {
			$article = $row->getArticle();
			$total += $row->quantity * $article->getPrice();
		}
		if($shippingAndHandlingCosts > 0) {
			$total += $shippingAndHandlingCosts;
		}
		return floatval($total);
	}

}